/* Copyright (C) 2005, 2006 by Daniel Gheorghian
 All rights reserved
 
 Use and distribute freely, except: don't remove my name from the source or documentation 
 (don't take credit for my work), mark your changes (don't get me blamed for your possible bugs),
 don't alter or remove this notice.
 
 No warrantee of any kind, express or implied, is included with this software; use at your
 own risk, responsibility for damages (if any) to anyone resulting from the use of this
 software rests entirely with the user.
 
 Send bug reports, bug fixes, enhancements, requests, flames, etc., and I'll try to keep 
 a version up to date.  I can be reached at: daniel.gheorghian@gmail.com
*/


package com.ds.components.grid;

import com.ds.theme.ColorTheme;

import java.awt.*;

public class GridCell
{
	private int colSpan;
	private int rowSpan;
	private int column;
	private int row;
	private Rectangle bounds;
	private ColorTheme colors;
	private boolean disabled;
	private boolean flash;

	public GridCell()
	{
		this( -1, -1, 1, 1, new Rectangle() );
	}

	public GridCell( int row, int column )
	{
		this( row, column, 1, 1, new Rectangle() );
	}

	public GridCell( int row, int column, int colSpan, int rowSpan, Rectangle cellBounds )
	{
		this.bounds = cellBounds;
		this.colSpan = colSpan;
		this.column = column;
		this.row = row;
		this.rowSpan = rowSpan;
		this.colors = null;
	}

	public Rectangle getBounds()
	{
		return bounds;
	}

	public void setBounds( Rectangle bounds )
	{
		this.bounds = bounds;
	}

	public void setCellLocation( Point p )
	{
		this.bounds.setLocation( p );
	}

	public void setCellSize( Dimension d )
	{
		this.bounds.setSize( d );
	}

	public Point getCellLocation()
	{
		return this.bounds.getLocation();
	}

	public Dimension getCellSize()
	{
		return this.bounds.getSize();
	}

	public int getColSpan()
	{
		return colSpan;
	}

	public void setColSpan( int colSpan )
	{
		this.colSpan = colSpan;
	}

	public int getColumn()
	{
		return column;
	}

	public void setColumn( int column )
	{
		this.column = column;
	}

	public int getRow()
	{
		return row;
	}

	public void setRow( int row )
	{
		this.row = row;
	}

	public int getRowSpan()
	{
		return rowSpan;
	}

	public void setRowSpan( int rowSpan )
	{
		this.rowSpan = rowSpan;
	}

	public void setColorTheme( ColorTheme colors )
	{
		this.colors = colors;
	}

	public ColorTheme getColorTheme()
	{
		return this.colors;
	}

	/**
	 * @return the disabled
	 */
	public boolean isDisabled()
	{
		return disabled;
	}

	/**
	 * @param disabled the disabled to set
	 */
	public void setDisabled( boolean disabled )
	{
		this.disabled = disabled;
	}

	/**
	 * @return the flash
	 */
	public boolean isFlash()
	{
		if( flash )
		{
			flash = false;
			return true;
		}

		return flash;
	}

	/**
	 * @param flash the flash to set
	 */
	public void setFlash( boolean flash )
	{
		this.flash = flash;
	}

	public String toString()
	{
		return "Row=" + this.row + "Column=" + this.column;
	}
}
